import { createBrowserRouter, Navigate } from "react-router-dom"
import Main from '../pages/main.js'
import Home from '../pages/home/index.js'
import Mall from '../pages/mall'
import user from '../pages/user'
import OtherPageOne from '../pages/other/otherPageOne'
import OtherPageTwo from '../pages/other/otherPageTwo'
import Login from '@/pages/login/index.js'

const routes = [
  {
    path: "/",
    Component: Main,
    children: [
      {
        path: '/',
        element: <Navigate to="home" replace></Navigate>
      },
      {
        path: "home",
        Component: Home,
      },
      {
        path: "mall",
        Component: Mall,
      },
      {
        path: "user",
        Component: user,
      },
      {
        path: "other",
        children: [
          {
            path: "pageOne",
            Component: OtherPageOne,
          },
          {
            path: "pageTwo",
            Component: OtherPageTwo,
          },
        ]
      }
    ]
  },
  {
    path: "login",
    Component: Login,
  }
]


export default createBrowserRouter(routes)